package com.sfd.test;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;

import java.net.InetAddress;

/**
 * @author haden
 * @date 2022/8/7 16:35
 **/
@SpringBootApplication
@EnableDiscoveryClient
@MapperScan(basePackages = {"com.sfd.test.mapper"})
@Slf4j
public class SfdTest2Application {
    public static void main(String[] args) {
        SpringApplication.run(SfdTest2Application.class);
    }

    @Bean
    public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
        return args -> log.info("项目:" + ctx.getEnvironment().getProperty("spring.application.name") + "启动啦，访问路径：{}", "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + ctx.getEnvironment().getProperty("server.port"));
    }
}
